package cn.yunyichina.provider.framework.utils;

import cn.yunyichina.provider.framework.data.SpringContextHandler;
import cn.yunyichina.provider.iface.entity.common.Response;
import cn.yunyichina.provider.iface.service.IService;

/**
 * 服务类
 * 
 * @author zhangkewen
 */
public class ServiceUtils {

    /**
     * 内部系统调用，返回下划线格式
     * 
     * @param sessionId
     * @param serviceName
     * @param method
     * @param data
     * @return
     */
    public static Response callUnderlineInternalService(String sessionId, String serviceName, String method, String data) {

        IService service = SpringContextHandler.getBean(serviceName);
        Response response = service.callUnderlineFromInternal(sessionId, method, data, (short) 0);
        return response;
    }

    /**
     * 内部系统调用，返回下划线格式
     * 
     * @param serviceName
     * @param method
     * @param data
     * @return
     */
    public static Response callUnderlineInternalService(String serviceName, String method, String data) {

        IService service = SpringContextHandler.getBean(serviceName);
        Response response = service.callUnderlineFromInternal("", method, data, (short) 0);
        return response;
    }

    /**
     * 
     * @param serviceName
     * @param method
     * @param data
     * @return
     */
    public static Response callHumpInternalService(String serviceName, String method, String data) {

        IService service = SpringContextHandler.getBean(serviceName);
        Response response = service.callHumpFromInternal("", method, data, (short) 0);
        return response;
    }

    public static Response callHumpInternalService(String sessionId, String serviceName, String method, String data) {

        IService service = SpringContextHandler.getBean(serviceName);
        Response response = service.callHumpFromInternal(sessionId, method, data, (short) 0);
        return response;
    }

}
